#pragma once
#ifndef AndroidAudioPicker_h__
#define AndroidAudioPicker_h__


#include <QObject>
#include <QAndroidActivityResultReceiver>
#include "../AbstractAudioPicker.h"
#include "AndroidPicker.h"

namespace TC
{
    class AndroidAudioPicker : public AbstractAudioPicker
    {
        Q_OBJECT
    public:
        AndroidAudioPicker(QObject *parent = nullptr)
            :AbstractAudioPicker(parent), picker("audio/*", parent)
        {
            QObject::connect(&picker, &AndroidPicker::fileUrlChanged, this, &AndroidAudioPicker::fileUrlChanged);
            QObject::connect(&picker, &AndroidPicker::accepted, this, &AndroidAudioPicker::accepted);
            QObject::connect(&picker, &AndroidPicker::rejected, this, &AndroidAudioPicker::rejected);
            QObject::connect(&picker, &AndroidPicker::error, this, &AndroidAudioPicker::error);
        }
    public:
        virtual QUrl fileUrl() final
        {
            return picker.fileUrl();
        }
    public slots:
        virtual void open() final
        {
            return picker.open();
        }
    private:
        QUrl _fileUrl;
        AndroidPicker picker;
    };
}
#endif // AndroidAudioPicker_h__
